
int main() {
    std::string brackets[] = {"()", "[]", "{}", "<>"};
    std::string inputString;

    std::cout << "Enter a sequence of brackets: ";
    std::getline(std::cin, inputString);
    inputString.erase(std::remove(inputString.begin(), inputString.end(), ' '), inputString.end());

    for (int c = 0; c < inputString.length() / 2; c++) {
        for (int i = 0; i < 4; i++) {
            inputString.replace(inputString.find(brackets[i]), brackets[i].length(), "");
        }
    }

    if (inputString.length() == 0) {
        std::cout << "True" << std::endl;
    } else {
        std::cout << "False" << std::endl;
    }

    return 0;
}

